<?php 
				
           		include("../Model/Connection.php");
           		
          
	            if (isset($_FILES['image']) && $_FILES['image']['size'][0] > 0) { 
	                  
	                  // Temporary file name stored on the server
	                for($i = 0; $i<5; $i++){  
	                  $tmpName  = $_FILES['image']['tmp_name'][$i];  
			
	                  // Read the file 
	                  $fp      = fopen($tmpName, 'r');
	                  $data = fread($fp, filesize($tmpName));
	                  $data = addslashes($data);
	                  fclose($fp);
	
	
	                  // Create the query and insert
	                  // into our database.
	                  
	                  /*lay ID*/
	                  if(isset($_GET['id'])){
	                  	$id = $_GET['id'];
	                  /*----------*/
	                  	$query = "INSERT INTO images(ID_APP, IMAGE) VALUES('$id', '$data')";
	                  	$results = mysql_query($query);
	                  }
					}
						  echo "ok";
	                  // Print results
	                  print "Thank you, your file has been uploaded.";
	      
	            }
	        else {
	                print "No image selected/uploaded";
	        }
	     
        ?>